1. Field of the Invention
The present invention relates to an image display apparatus, for computer graphics (CG), for displaying an object which includes polygons wherein opaque pixels and translucent pixels coexist, and an image display method therefor.
2. Related Arts
According to computer graphic (CG) techniques, an object in virtual three-dimensional space is constituted by at least one polygon. Each polygon is itself constituted by at least one pixel. In order to display such an object on an image display apparatus, virtual three-dimensional space is converted to provide a two-dimensional plane which corresponds to the screen of an image display apparatus, and the object is displayed on the two-dimensional plane.
Therefore, when a plurality of objects are located in the direction of depth (hereinafter referred to as direction Z) in virtual three-dimensional space, of these objects a foreground object is displayed on the screen of the image display apparatus.
To exercise this control, a conventional image display apparatus includes a depth buffer in which the coordinate in direction Z (hereinafter referred to as a Z coordinate) of an object is written. When the Z coordinate of a specific object is written in the depth buffer, and when the Z coordinate of another object, which is to be drawn later, is located deeper than the Z coordinate stored in the depth buffer, the second object is not displayed. Conventionally, the Z coordinate of an object is written for each polygon which constitutes the object.
In the control of the display of an object using the depth buffer, when a plurality of objects are constituted by translucent polygons, which include translucent pixels (opaque pixels may coexist), an object having the deepest Z coordinate is drawn first. As a result, the objects can be so displayed that the objects located deeper in direction Z can be seen through the translucent portion of the foreground object.
Assume that when an object having the deepest Z coordinate can not be drawn first, i.e., when the Z coordinate of an object to be drawn later is deeper than is the Z coordinate of an object which was drawn previously. Since the object to be drawn later is located deeper than is the Z coordinate stored in the depth buffer, this object is not displayed on the screen. Therefore, a display can not be provided on which an object drawn later can be visible through the translucent portion of another object which was drawn earlier.
In addition, if the Z coordinate of an object which was drawn earlier is not written in the depth buffer, when another object is drawn later, that object could would be displayed on the screen. However, in this case, although the object to be drawn later is located deeper than is the earlier drawn object, the object drawn later is displayed as though it should appear in front of the object drawn earlier.
Therefore, to draw a plurality of objects in which translucent polygons are included, the object located deepest in the Z direction must be first drawn. However, when the objects intersect each other in the Z direction, i.e., when one part of an object to be drawn later is located deeper than the object which was drawn earlier, the above described shortcoming arises.
As is described above, when objects which are constituted by translucent polygons intersect each other in the Z direction, the relationship of the positions as they pertain to the depth of the translucent polygons can not be correctly represented by employing a presently available, conventional writing control process for a depth buffer.
In order to resolve this shortcoming, conventionally, proposed is a method according to which each translucent polygon is divided at the intersecting portion. However, this method is not preferable because of the increased processing load which is imposed on the image display apparatus.
An image display apparatus is proposed with which processing for each of the pixels constituting a polygon is performed. However, with such an image display apparatus an enormous amount of image display processing is necessary, and this is not acceptable for an image display apparatus, such as a video game machine, for which real-time and interactive processing are required.
It is one objective of the present invention to provide an image display apparatus which can adequately display translucent polygons without increasing the processing load, and an image display method therefor.
To achieve the above objective, according to the present invention, an image display apparatus for displaying polygons, each of which is located in a virtual three-dimensional space of an XYZ coordinate system based on a viewpoint and is constituted by at least one pixel having XYZ coordinates, on the two-dimensional plane of an XY coordinate system comprises:
a storage unit in which a Z coordinate corresponding to predetermined XY coordinates is written;
a determination unit for determining the transparency of the pixel;
a writing control unit for controlling the writing of the Z coordinate of the pixel into the storage unit based on the results obtained by the determination unit; and
a display unit for displaying, at the predetermined XY coordinates, a pixel having the Z coordinate written in the storage unit and/or the Z coordinate nearer to the viewpoint than the Z coordinate written in the storage unit.
The determination unit determines, for example, whether a pixel is opaque. A first flag is set for controlling the writing of the Z coordinate of an opaque pixel in the storage unit, and a second flag is set for controlling the writing of the Z coordinate of a pixel which is not opaque. In accordance with the states of the first and the second flags, the writing control unit controls the writing the Z coordinate of the pixel which is opaque and which is not opaque into the storage unit respectively.
Furthermore, to achieve the above objective, according to the present invention, an image display method for displaying polygons, each of which is located in the virtual three-dimensional space of an XYZ coordinate system based on a viewpoint and is constituted by at least one pixel having XYZ coordinates, on the two-dimensional plane of an XY coordinate system comprises:
a determination step for determining a transparency of the pixel;
a control step for controlling the writing of the Z coordinate of the pixel into a storage unit based on the results obtained by the determination step; and
a display step for displaying, at predetermined XY coordinates, a pixel having the Z coordinate written in the storage unit and/or the Z coordinate nearer to the viewpoint than the Z coordinate written in the storage unit.
At the determination step, for example, a check is performed to determine whether a pixel is opaque. A first flag is set for controlling the writing of the Z coordinate of an opaque pixel in the storage unit, and a second flag is set for controlling the writing of the Z coordinate of a pixel which is not opaque. At the control step, the writing the Z coordinates of the pixel which is opaque and not opaque into the storage unit is controlled in accordance with the states of the first and the second flags respectively.